using System;
using System.Collections.Generic;


namespace LiveCS.Models
{
	[Serializable]
	public class Teaminformation: IEquatable<Teaminformation>
	{

		#region Private Members

		private Teamgroup _classid; 
		private string _cardid; 
		private IList<Teaminformation> _TeaminformationList; 
		private IList<Teaminformation> _TeaminformationList; 
		private string _groupid; 
		private string _fightid; 		
		#endregion

		#region Constructor

		public Teaminformation()
		{
			_classid = new Teamgroup(); 
			_cardid = String.Empty; 
			_TeaminformationList = new List<Teaminformation>(); 
			_TeaminformationList = new List<Teaminformation>(); 
			_groupid = String.Empty; 
			_fightid = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public Teaminformation(
			string cardid)
			: this()
		{
			_classid = null;
			_cardid = cardid;
			_groupid = String.Empty;
			_fightid = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual Teamgroup Classid
		{
			get
			{ 
				return _classid;
			}
			set
			{
				_classid = value;
			}

		}
			
		public virtual string Cardid
		{
			get
			{ 
				return _cardid;
			}

			set	
			{	
				if( value == null )
					throw new ArgumentOutOfRangeException("Null value not allowed for Cardid", value, "null");
				
				if(  value.Length > 40)
					throw new ArgumentOutOfRangeException("Invalid value for Cardid", value, value.ToString());
				
				_cardid = value;
			}
		}
			
		public virtual IList<Teaminformation> TeaminformationList
		{
			get
			{
				return _TeaminformationList;
			}
			set
			{
				_TeaminformationList = value;
			}
		}

		public virtual IList<Teaminformation> TeaminformationList
		{
			get
			{
				return _TeaminformationList;
			}
			set
			{
				_TeaminformationList = value;
			}
		}

		public virtual string Groupid
		{
			get
			{ 
				return _groupid;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Groupid", value, value.ToString());
				
				_groupid = value;
			}
		}
			
		public virtual string Fightid
		{
			get
			{ 
				return _fightid;
			}

			set	
			{	
				if(  value != null &&  value.Length > 20)
					throw new ArgumentOutOfRangeException("Invalid value for Fightid", value, value.ToString());
				
				_fightid = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		public virtual void AddTeaminformation(Teaminformation obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_TeaminformationList.Add(obj);
		}
		

		public virtual void AddTeaminformation(Teaminformation obj)
		{
			#region Check if null
			if (obj == null)
				throw new ArgumentNullException("obj", "El parametro no puede ser nulo");
			#endregion
			_TeaminformationList.Add(obj);
		}
		

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			Teaminformation castObj = (Teaminformation)obj; 
			return ( castObj != null ) &&
				( this._cardid == castObj.Cardid );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _cardid.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(Teaminformation other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._cardid == other.Cardid );
				   
		}

		#endregion
		
	}
}
